﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.views.components.mainmenu {
    import reprise.ui.*;
    import flash.events.*;
    import flash.display.*;
    import reprise.controls.*;
    import net.wooga.pets.events.*;
    import net.wooga.pets.utils.*;

    public class DoctorScrollItem extends reprise.controls.SimpleButton {

        private var m_detailPanel:UIComponent;
        private var m_infoPanel:UIComponent;
        private var m_background:UIComponent;
        private var m_docId:String;
        private var m_type:String;
        private var m_hungryText:String;
        private var m_imageDisplay:UIComponent;
        private var m_hungryLabel:Label;
        private var m_treatmentLabel:Label;
        private var m_treatmentLogoDisplay:UIComponent;
        private var m_roomType:String;
        private var m_hungryPanel:UIComponent;
        private var m_timeLabel:Label;
        private var m_name:String;
        private var m_treatmentText:String;
        private var m_showText:String;

        public function DoctorScrollItem(_arg1:String, _arg2:String, _arg3:String, _arg4:String, _arg5:String, _arg6:String, _arg7:String){
            this.m_docId = _arg1;
            this.m_type = _arg2;
            this.m_name = _arg5;
            this.m_hungryText = _arg7;
            this.m_roomType = _arg3;
            this.m_treatmentText = _arg4;
            this.m_showText = _arg6;
        }
        override public function remove(... _args):void{
            removeEventListener(MouseEvent.MOUSE_OVER, this.handleMouseOver);
            removeEventListener(MouseEvent.MOUSE_OUT, this.handleMouseOut);
            removeEventListener(MouseEvent.CLICK, this.handleMouseClick);
            super.remove();
        }
        public function get doctorId():String{
            return (this.m_docId);
        }
        public function showHungry():void{
            removeEventListener(MouseEvent.MOUSE_OVER, this.handleMouseOver);
            removeEventListener(MouseEvent.MOUSE_OUT, this.handleMouseOut);
            removeEventListener(MouseEvent.CLICK, this.handleMouseClick);
            this.m_hungryPanel.show();
            this.m_infoPanel.hide();
            this.m_detailPanel.hide();
            this.m_background.addCSSClass("withTop");
        }
        public function hideHungry():void{
            this.m_hungryPanel.hide();
            this.m_infoPanel.show();
            this.m_background.removeCSSClass("withTop");
            addEventListener(MouseEvent.MOUSE_OVER, this.handleMouseOver);
            addEventListener(MouseEvent.MOUSE_OUT, this.handleMouseOut);
        }
        public function setHungryIn(_arg1:String):void{
            ((!((_arg1 == "0"))) && (this.m_timeLabel.setLabel(_arg1)));
        }
        override protected function initialize():void{
            addCSSClass("scrollItem");
            addEventListener(MouseEvent.MOUSE_OVER, this.handleMouseOver);
            addEventListener(MouseEvent.MOUSE_OUT, this.handleMouseOut);
            addEventListener(MouseEvent.CLICK, this.handleMouseClick);
            super.initialize();
        }
        override protected function createChildren():void{
            this.m_background = addComponent("scrollItemBackground");
            this.infoPanel();
            this.detailPanel();
            this.hungryPanel();
        }
        private function infoPanel():void{
            this.m_infoPanel = addComponent("panelDisplay");
            this.m_infoPanel.addCSSClass("doctor");
            var _local1:MovieClip = AssetsLibrary.getMovieClip((this.m_type + "DoctorThumb"));
            this.m_imageDisplay = this.m_infoPanel.addComponent("imageDisplay");
            this.m_imageDisplay.cacheAsBitmap = true;
            this.m_imageDisplay.addChild(_local1);
            var _local2:Label = Label(this.m_infoPanel.addComponent("typeLabelInfo", null, Label));
            _local2.setLabel(this.m_name);
            this.m_timeLabel = Label(this.m_infoPanel.addComponent("timerLabel", null, Label));
        }
        private function detailPanel():void{
            this.m_detailPanel = addComponent("panelDisplay");
            this.m_detailPanel.hide();
            var _local1:MovieClip = AssetsLibrary.getMovieClip(("CustomizeIcon" + this.m_roomType));
            _local1.scaleX = (_local1.scaleY = 0.8);
            _local1.cacheAsBitmap = true;
            this.m_treatmentLogoDisplay = this.m_detailPanel.addComponent("doctorTreatmentLogoDisplay");
            this.m_treatmentLogoDisplay.addChild(_local1);
            this.m_treatmentLabel = Label(this.m_detailPanel.addComponent("treatmentLabel", null, Label));
            this.m_treatmentLabel.setLabel(this.m_treatmentText);
        }
        private function hungryPanel():void{
            this.m_hungryPanel = addComponent("panelDisplay");
            this.m_hungryPanel.hide();
            this.m_hungryPanel.addComponent("food");
            var _local1:Label = Label(this.m_hungryPanel.addComponent("typeLabel", null, Label));
            _local1.setLabel(this.m_name);
            this.m_hungryLabel = Label(this.m_hungryPanel.addComponent("readyLabel", null, Label));
            this.m_hungryLabel.setLabel(this.m_hungryText);
        }
        private function handleMouseOut(_arg1:MouseEvent):void{
            this.m_infoPanel.show();
            this.m_detailPanel.hide();
            this.m_background.removeCSSClass("withTop");
        }
        private function handleMouseOver(_arg1:MouseEvent):void{
            this.m_infoPanel.hide();
            this.m_detailPanel.show();
            this.m_background.addCSSClass("withTop");
        }
        private function handleMouseClick(_arg1:MouseEvent):void{
            dispatchEvent(new ViewCompEvent(ViewCompEvent.CLICK, this.m_docId));
        }

    }
}//package net.wooga.pets.views.components.mainmenu 
